/**
 * 团队功能API调用
 * data: {data: {uid: uid}, token: token}
 * 返回Axios Promise实例,其中的data才是真正从服务器返回的数据
 */

import axios from 'axios'

const baseurl = '/giraffe/group'

export const createGroup = (data) => axios.post(
  `${baseurl}/createGroup`, data,
  {headers: {'Content-Type': 'application/json'}}
).then(
  (res) => {
    return res
  }
)

export const findGroup = (data) => axios.post(
  `${baseurl}/findGroup`,
  data,
  {headers: {'Content-Type': 'application/json'}}
).then(
  (res) => {
    return res
  }
)

export const generatorCode = (data) => axios.post(
  `${baseurl}/generatorCode`, data,
  {headers: {'Content-Type': 'application/json'}}
).then(
  (res) => {
    return res
  }
)

export const getGroupInfo = (data) => axios.post(
  `${baseurl}/getGroupInfo`, data,
  {headers: {'Content-Type': 'application/json'}}
).then(
  (res) => {
    return res
  }
)

export const joinGroup = (data) => axios.post(
  `${baseurl}/joinGroup`, data,
  {headers: {'Content-Type': 'application/json'}}
).then(
  (res) => {
    return res
  }
)
